 var uid = sessionStorage.getItem("u_group_no");
 $(function () {
	 /* 获取订单类别的点击事件 */
	$("#category_select").on("change", function(){
		//订单类别
	 	var take_type = $(this).children('option:selected').val(); 
		if(take_type === "1" || take_type === "2"){
			var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "take_type": take_type, "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
			ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
		}else{
			var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
			ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
		}
		
	 });
 
	var paramJson = { "actName": "GetIndentM", "rows": "", "page": "", "utype": "5", "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
	ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);

	/* 订单列表详情点击 */
	$("#shop_order_list").on("click", ".order-details", function(){
		var prescription_id = $(this).attr("data-Pid");
		var indent_no = $(this).attr("data-Iid");
		
		window.location.href = "shop_order_details.html?prescription_id=" + prescription_id + "&indent_no=" + indent_no
	});
	
});

/* 获取处方信息 */
function doOk(rstData) {
	console.log(rstData);
	if (rstData.code === "1" && rstData.list.length > 0) {
		/* for (var i = 0; i < rstData.list.length; i++) {
			store_score = rstData.list[0].store_score;
			log_score = rstData.list[0].log_score;
		} */
		//生成html片段
		var html = template("shopOrderList",rstData);
		var container = document.getElementById("shop_order_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
	else{
		//生成html片段
		var html = template("noData",rstData);
		var container = document.getElementById("shop_order_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
}